package xin.lhuo.we.server.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import xin.lhuo.we.server.entity.Album;

import java.util.List;

/**
 * @author Lhuo
 * @date 2019/5/11 17:10
 */
@Mapper
@Component
public interface AlbumMapper {
    int save(Album album);

    int checkName(@Param("name") String name, @Param("userId") Integer userId);

    int checkByUserIdAndId(@Param("id")Integer id, @Param("userId") Integer userId);

    List<Album> selectAllByUserId(Integer userId);

    void deleteById(Integer id);

    Album selectById(Integer id);

    int rename(@Param("id") Integer id,@Param("name") String name);

    void updateCoverUrlById(@Param("id")Integer id,
                            @Param("coverUrl")String coverUrl,
                            @Param("coverKey") String coverKey,
                            @Param("userId")Integer userId);

    int countByUserId(Integer userId);
}
